//################################################################################################################################//
//##                                                                                                                            ##//    
//## This Page is implement for show the dentist content after Dentist's login                                                  ##//
//##                                                                                                                            ##//
//## Author   : Prashant Tomar                                                                                                  ##//
//## Dated    : 06-07-2007                                                                                                      ##//
//##                                                                                                                            ##//    
//################################################################################################################################//
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using SiteManager;

public partial class Dentist_DentistContent : System.Web.UI.Page
{
    #region creating an instance of manager class and Local Variable
    Manager mgr = new Manager(true,"ConnectionString");
    protected bool isFeatured = false;
    #endregion

    #region Page Load
    protected void Page_Load(object sender, EventArgs e)
    {
        // COMMENTED TO AVOID LOGIN WHILE LOGGED IN AS DENTIST
        // DATE 15TH FEB 2008
        // if (Session["userID"] != null && Session["userID"].ToString() != "")
        localFunction obj = new localFunction();

        if (obj.checkDentistLogin(true))
        {
            if (!Page.IsPostBack)
            {
                //Fill Dentist Name and his/her speciality in your account box                
                ShowDntInformation();
            }
        }
        else
        {
            Response.Redirect(Session["strHttps"]+"doctor/doctorLogin.aspx");
        }

        Master.fVisible = true;
    }
    #endregion

    #region ShowDrInformation method for Fill Dentist Name and his/her speciality in your account box
    protected void ShowDntInformation()
    {
        //fetch Dentist information using Session["userID"] from tbl_Dentists,tbl_DentistSpecialty
        string SQL = " SELECT (tbl_Dentists.FName + ' ' + tbl_Dentists.MName  + ' ' + tbl_Dentists.LName)AS name,tbl_DentistSpecialty.Specialty, ";
        SQL += "isnull((select top 1 1 from tbl_dentist_bidding where trx_status=1 and Dnt_Id=" + Session["userID"] + "),0) as isfeture ";
        SQL = SQL + " FROM ";
        SQL = SQL + " tbl_Dentists LEFT OUTER JOIN tbl_DentistSpecialty ON tbl_Dentists.SpecialityID = tbl_DentistSpecialty.Id";
        SQL = SQL + " WHERE tbl_Dentists.Id = " + Session["userID"];

        using (System.Data.SqlClient.SqlDataReader dr = mgr.ExecuteQuery(SQL))
        {
            if (dr.Read())
            {
                lblDentistName.Text = dr.GetString(0);
                lblSpeciality.Text = dr.GetString(1);
                switch (dr.GetInt32(2))
                {
                    case 1:
                  //      isFeatured = true;
                        break;
                    default:
                  //      isFeatured = false;
                        break;
                }
            }
            dr.Close();
        }
    }
    #endregion

    protected void linkEditDntAccount_Click(object sender, EventArgs e)
    {
        Session["pageFromOrAction"] = "Edit";
        Response.Redirect(Convert.ToString(Session["strHttps"]) + "dentist/DentistRegistration.aspx?id=" + Session["userid"].ToString());
    }
    protected void linkChangeDrPassword_Click(object sender, EventArgs e)
    {
        //Redirect page on doctorForgotPass.aspx for retrive the forgot password
        //Response.Redirect("DentistForgotPass.aspx");
        Response.Redirect(Session["strHttp"].ToString() + "dentist/DentistChangePassword.aspx");
    }
    protected void lnkViewProfile_Click(object sender, EventArgs e)
    {
        localFunction obj = new localFunction();
        obj.GetDentInfo(false);
        // Response.Redirect("DentistDetails.aspx?id=" + Session["userid"].ToString());
    }

    protected void lnkCommunity_Click(object sender, EventArgs e)
    {
        Response.Redirect(Session["strHttp"].ToString() + "Community/AddUpdateBlog.aspx");
    }

    protected void lnkbtnResource_Click(object sender, EventArgs e)
    {
        //Response.Redirect("dentistResources.aspx?id=" + Session["userid"].ToString());
        Response.Redirect(Session["strHttp"].ToString() + "dentist/dentistResources.aspx?id=" + Session["userid"].ToString());
    }
    protected void lbnMycalander_Click(object sender, EventArgs e)
    {
        Response.Redirect("DentistCalendar.aspx?dentistId=" + Session["userid"].ToString());
    }
}
